module.exports = {
  roots: ['<rootDir>', '<rootDir>/src'],
  collectCoverageFrom: [
    'src/**/*.{ts,tsx}',
    '!src/**/*.d.ts',
    '!src/i18n/index.ts',
    '!src/i18n/resources/modules/*.ts',
    '!src/components/**/*.tsx',
    '!src/stores/**/*.ts',
    '!src/typings/*.ts',
    '!src/views/**/*.tsx',
    '!src/shared/variablePresets.ts',
    '!src/shared/file.ts',
    '!src/services/mocks/**/*.ts',
    '!src/App.ts',
    '!src/index.ts',
  ],
  setupFiles: ['react-app-polyfill/jsdom'],
  setupFilesAfterEnv: ['<rootDir>/tests/setup.ts'],
  testMatch: [
    '<rootDir>/src/**/__tests__/**/*.{js,jsx,ts,tsx}',
    '<rootDir>/src/**/*.{spec,test}.{js,jsx,ts,tsx}',
    '<rootDir>/tests/**/*.{spec,test}.{js,jsx,ts,tsx}',
  ],
  testEnvironment: 'jsdom',
  testRunner: './node_modules/jest-circus/runner.js',
  transform: {
    '^.+\\.(js|jsx|mjs|cjs|ts|tsx)$': '<rootDir>/node_modules/babel-jest',
    '^.+\\.css$': '<rootDir>/config/jest/cssTransform.js',
    '^(?!.*\\.(js|jsx|mjs|cjs|ts|tsx|css|json)$)': '<rootDir>/config/jest/fileTransform.js',
  },
  transformIgnorePatterns: [
    '[/\\\\]node_modules[/\\\\].+\\.(js|jsx|mjs|cjs|ts|tsx)$',
    '^.+\\.module\\.(css|sass|scss|less)$',
    '/node_modules/(?!antd|@ant-design|rc-.+?|@babel/runtime).+(js|jsx)$',
  ],
  modulePaths: [],
  moduleNameMapper: {
    '^react-native$': 'react-native-web',
    '^.+\\.module\\.(css|sass|scss|less)$': 'identity-obj-proxy',
    'shared/(.*)': '<rootDir>/src/shared/$1',
    'styles/(.*)': '<rootDir>/src/styles/$1',
    'libs/(.*)': '<rootDir>/src/libs/$1',
    'services/(.*)': '<rootDir>/src/services/$1',
    'typings/(.*)': '<rootDir>/src/typings/$1',
    'views/(.*)': '<rootDir>/src/views/$1',
    'components/(.*)': ['<rootDir>/src/components/$1', '@ant-design/icons'],
    'i18n/(.*)': '<rootDir>/src/i18n/$1',
    i18n: '<rootDir>/src/i18n/index.ts',
  },
  moduleFileExtensions: [
    'web.js',
    'js',
    'web.ts',
    'ts',
    'web.tsx',
    'tsx',
    'json',
    'web.jsx',
    'jsx',
    'node',
  ],
  watchPlugins: ['jest-watch-typeahead/filename', 'jest-watch-typeahead/testname'],
  resetMocks: true,
};
